/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.emex.app.shared.data.enums;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Sergey Karavaev
 */
public enum OrderStatus {

    IN_PROGRESS(0),
    COMPLTED(1),
    STAFFED(2);

    private int statusNo;

    private static Map<Integer, OrderStatus> map
            = new HashMap<Integer, OrderStatus>();

    static {
        for (OrderStatus ord : OrderStatus.values()) {
            map.put(ord.statusNo, ord);
        }
    }

    private OrderStatus(final int no) {
        statusNo = no;
    }

    public static OrderStatus valueOf(int no) {
        return map.get(no);
    }

    @Override
    public String toString() {
        switch (this) {
            case IN_PROGRESS:
                return "В работе";
            case COMPLTED:
                return "Выполнен";
            case STAFFED:
                return "Укомплектован";
            default:
                return "";
        }
    }
}
